package com.tdkj.service.risevalue.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tdkj.dao.risevalue.IBeanAuctionRuleDao;
import com.tdkj.model.risevalue.BeanAuctionRule;
import com.tdkj.service.BaseService;
import com.tdkj.service.risevalue.IBeanAuctionRuleService;
            
@Component("auctionRuleService")
public class BeanAuctionRuleServiceImpl extends BaseService implements IBeanAuctionRuleService{
	
	private  IBeanAuctionRuleDao beanAuctionRuleDao;
	                              
	@Resource
	public void setBeanAuctionRuleDao(IBeanAuctionRuleDao beanAuctionRuleDao) {
		this.beanAuctionRuleDao = beanAuctionRuleDao;
	}

	public IBeanAuctionRuleDao getBeanAuctionRuleDao() {
		return beanAuctionRuleDao;
	}

	@Override
	public void add(BeanAuctionRule bean) {
		beanAuctionRuleDao.save(bean);
	}

	@Override
	public void delete(long id) {
		BeanAuctionRule bean = beanAuctionRuleDao.findById(id, BeanAuctionRule.class);
		beanAuctionRuleDao.delete(bean);
	}

	@Override
	public List<BeanAuctionRule> getAll() {
		return beanAuctionRuleDao.findAll(BeanAuctionRule.class);
	}

	@Override
	public void update(long id, int hight, int low, int radices) {
		BeanAuctionRule bean = beanAuctionRuleDao.findById(id, BeanAuctionRule.class);
		bean.setHight(hight);
		bean.setLow(low);
		bean.setRadices(radices);
	}

	@Override
	public void update(List<Long> ids, List<Integer> hights, List<Integer> lows,
			List<Integer> radiceses) {
		for(int i=0; i<ids.size(); i++){
			BeanAuctionRule bean = beanAuctionRuleDao.findById(ids.get(i), BeanAuctionRule.class);
			bean.setHight(hights.get(i));
			bean.setLow(lows.get(i));
			bean.setRadices(radiceses.get(i));
		}
		
	}


}
